package com.nameless.handle;

import com.nameless.exception.PermissionException;
import com.nameless.vo.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author keluoyisi
 * @program: tong-parent
 * @description:
 * @date 2023-02-24 10:53:29
 */
@RestControllerAdvice
public class GlobalException {
    @ExceptionHandler(value = PermissionException.class)
    public Result hasPermission(PermissionException permissionException){
        return new Result(401,permissionException.getMessage());
    }
}